home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 2.toast / pc / sample code / quicktime / goodies / qtmoviefromprocs / qtmoviefromprocs.h < prev    next >
Encoding:
Text File  |  2000-06-23  |  4.1 KB  |  150 lines

  1. //////////
  2. //
  3. //    File:        QTMovieFromProcs.h
  4. //
  5. //    Contains:    Code for creating a QuickTime movie using application-defined procedures.
  6. //
  7. //    Written by:    Tim Monroe
  8. //
  9. //    Copyright:    © 1998 by Apple Computer, Inc., all rights reserved.
  10. //
  11. //    Change History (most recent first):
  12. //
  13. //       <1>         10/16/98    rtm        first file
  14. //     
  15. //////////
  16.  
  17. #pragma once
  18.  
  19. // header files
  20.  
  21. #ifndef __FILES__
  22. #include <Files.h>
  23. #endif
  24.  
  25. #ifndef __MOVIES__
  26. #include <Movies.h>
  27. #endif
  28.  
  29. #ifndef __QUICKTIMECOMPONENTS__
  30. #include <QuickTimeComponents.h>
  31. #endif
  32.  
  33. #ifndef __SCRIPT__
  34. #include <Script.h>
  35. #endif
  36.  
  37. #ifndef __NUMBERFORMATTING__
  38. #include <NumberFormatting.h>
  39. #endif
  40.  
  41. #ifndef __QTUtilities__
  42. #include "QTUtilities.h"
  43. #endif
  44.  
  45. #if TARGET_OS_MAC
  46. #include "MacFramework.h"
  47. #elif TARGET_OS_WIN32
  48. #include "WinFramework.h"
  49. #endif
  50.  
  51. //////////
  52. //
  53. // compiler flags
  54. //
  55. //////////
  56.  
  57. #define TESTING_MOVIEFROMPROCS            1                // compiler flag for our test shell
  58.  
  59.  
  60. //////////
  61. //
  62. // constants
  63. //
  64. //////////
  65.  
  66. #define kMovieLengthInSeconds            10                // the length, in seconds, of our proc-generated movie
  67.  
  68. #define kAudioSampleRate                22050            // 22.05 kHz
  69. #define kSoundBufferSize                1024
  70.  
  71. #define kVideoSampleRate                3000            // 30 frames per second
  72. #define kVideoFrameDuration                100
  73.  
  74. #define kVideoFrameHeight                120L
  75. #define kVideoFrameWidth                160L
  76.  
  77. // type and creator for our sample settings preferences file
  78. #define kSettingsFileType                FOUR_CHAR_CODE('Pref')
  79. #define kSettingsFileCreator            FOUR_CHAR_CODE('RTM ')
  80.  
  81. // the name of our preferences file
  82. #define kSettingsFileName                "ProcPrefs.rtm"
  83.  
  84. // strings for Standard File Package dialog box
  85. #define kSaveMoviePrompt                "Save new movie file as:"
  86. #define kSaveMovieFileName                "Untitled.mov"
  87.  
  88. // maximum number of exporters-by-procedures we'll list in the Test menu
  89. #define kMaxNumTestMenuItems            32
  90. #define kTestMenuID                        131
  91.  
  92.  
  93. //////////
  94. //
  95. // data types
  96. //
  97. //////////
  98.  
  99. // a structure to hold information that we want to be passed to the app-defined
  100. // procedure that generates audio data
  101. typedef struct {
  102.     Ptr                            fSoundData;
  103.     SoundDescriptionHandle        fSoundDescription;
  104.     long                        fTrackID;
  105. } QTMoovProcsAudioDataRec, *QTMoovProcsAudioDataRecPtr;
  106.  
  107. // a structure to hold information that we want to be passed to the app-defined
  108. // procedure that generates video data
  109. typedef struct {
  110.     GWorldPtr                    fGWorld;
  111.     ImageDescriptionHandle        fImageDescription;
  112.     long                        fTrackID;
  113. } QTMoovProcsVideoDataRec, *QTMoovProcsVideoDataRecPtr;
  114.  
  115. // a structure to hold information about the available components that can export using procedures
  116. typedef struct {
  117.     MenuReference                fTestMenuHandle;
  118.     short                        fNextAvailIndex;
  119.     OSType                         fComponentType[kMaxNumTestMenuItems];
  120.     OSType                         fComponentSubType[kMaxNumTestMenuItems];
  121.     OSType                         fComponentManufacturer[kMaxNumTestMenuItems];
  122. } QTProcExportersInfo;
  123.  
  124.  
  125. //////////
  126. //
  127. // function prototypes
  128. //
  129. //////////
  130.  
  131. OSErr                            QTMoovProcs_CreateMovieFromProcs (MovieExportComponent theExporter, Boolean thePromptUser);
  132. OSErr                            QTMoovProcs_AddAudioSourceToExporter (MovieExportComponent theExporter);
  133. OSErr                            QTMoovProcs_AddVideoSourceToExporter (MovieExportComponent theExporter);
  134. PASCAL_RTN OSErr                QTMoovProcs_AudioTrackPropertyProc (void *theRefcon, long theTrackID, OSType thePropertyType, void *thePropertyValue);
  135. PASCAL_RTN OSErr                QTMoovProcs_AudioTrackDataProc (void *theRefcon, MovieExportGetDataParams *theParams);
  136. PASCAL_RTN OSErr                QTMoovProcs_VideoTrackPropertyProc (void *theRefcon, long theTrackID, OSType thePropertyType, void *thePropertyValue);
  137. PASCAL_RTN OSErr                QTMoovProcs_VideoTrackDataProc (void *theRefcon, MovieExportGetDataParams *theParams);
  138.  
  139. OSErr                            QTMenu_InitializeTestMenu (void);
  140. OSErr                            QTMenu_AddComponentNamesToMenu (void);
  141. OSErr                            QTMenu_HandleTestMenu (UInt16 theMenuItem);
  142.  
  143. OSErr                            QTMoovProcs_GetPrefsFileSpec (FSSpecPtr thePrefsSpecPtr, void *theRefCon);
  144.  
  145. OSErr                            QTUtils_SaveExporterSettingsInFile (MovieExportComponent theExporter, FSSpecPtr theFSSpecPtr);
  146. OSErr                            QTUtils_GetExporterSettingsFromFile (MovieExportComponent theExporter, FSSpecPtr theFSSpecPtr);
  147. OSErr                            QTUtils_WriteHandleToFile (Handle theHandle, FSSpecPtr theFSSpecPtr);
  148. Handle                            QTUtils_ReadHandleFromFile (FSSpecPtr theFSSpecPtr);
  149.  
  150.